module Vote.Internal.Util where

import Control.Lens (Ixed (..), (%~))
import Language.Haskell.TH (Name, nameBase)
import Protolude
import Data.String (String)

--

upperFirst :: String -> String
upperFirst = ix 0 %~ toUpper

lowerFirst :: String -> String
lowerFirst = ix 0 %~ toLower

--

trimPrefixName :: Name -> String -> String
trimPrefixName name = lowerFirst . drop (length $ nameBase name)

trimPrefixName_ :: Name -> String -> String
trimPrefixName_ name = lowerFirst . drop 1 . drop (length $ nameBase name)